public class three {
    public static int isPrime(int a) {
        int h = 1;
        for (int i = 2; i < a; i++) {
            if (a % i == 0) {
                h = 0;
                break;
            }
        }
        return h;
    }

    public static void main(String[] args) {
        int g = 0;

        for (int j = 2; j < 20000; j++) {
            int k = isPrime(j);
            if (k == 1) {
                System.out.print(j + " ");
                g++;
                if (g % 5 == 0) {
                    System.out.println();
                }
            }
        }
    }
}